SSTACK SEGMENT STACK 
       DB 100 DUP(?)
SSTACK ENDS

DATA SEGMENT

AM  DB 20,-10,20,-10,20,-10,20,-10,20,-10,20,-10,20,-10,20,-10,20,-10,20,-10
BM  DB 20 DUP(?)
CM  DB 20 DUP(?)
DM  DB 0
EM  DB 0

DATA ENDS

CODE SEGMENT                                                                                                                                                                                                                                                                                                          
MAIN PROC FAR
       ASSUME CS:CODE,DS:DATA,SS:SSTACK 
START: PUSH DS 
       XOR  AX,AX
       PUSH AX
       MOV AX,DATA
       MOV DS,AX
       
       
       MOV AX,0
       MOV BX,OFFSET AM
       MOV DX,0
       MOV CX,20
       MOV SI,OFFSET CM
       MOV DI,OFFSET DM

S:     
       CMP BYTE PTR [BX],0
       JL XIAO
       MOV DL,[BX]
       MOV [SI],DL
       INC SI
       INC EM                                                                              


XIAO:  MOV DL,[BX]
       MOV [DI],DL
       INC DI
       INC DM

                                                                                                                                                                                                                            
       INC BX
       LOOP S
       

       RET

       ;  MOV AX,4C00H
       ;  INT 21H

    
MAIN ENDP
CODE ENDS
     END START
